package com.g4m.baselib.component;

import org.springframework.context.ApplicationContext;

public class SpringContext {
    private static ApplicationContext applicationContext;

    /**
     * 获取上下文
     *
     * @return 上下文
     */
    public static ApplicationContext getApplicationContext() {
        return applicationContext;
    }

    /**
     * 上下文
     *
     * @param context 内容
     */
    public static void setApplicationContext(ApplicationContext context) {
        applicationContext = context;
    }

    /**
     * 获取bean
     *
     * @param name 名称
     * @return bean
     */
    public static Object getBean(String name) {
        return applicationContext.getBean(name);
    }
}

